home *** CD-ROM | disk | FTP | other *** search
/ The Learning Curve / The Learning Curve (Weird Science, 1996).iso / s / pickmap < prev    next >
AmigaDOS Script File  |  1992-01-09  |  3KB  |  142 lines

  1. .key target,initial/s
  2. .bra «
  3. .ket »
  4. .def target sys:
  5.  
  6. ; make required commands resident
  7. resident >NIL: c:copy add pure
  8. resident >NIL: c:list add pure
  9. resident >NIL: c:makedir add pure
  10. resident >NIL: c:search add pure
  11. resident >NIL: c:type add pure
  12.  
  13. ; build the keymap choice table
  14. failat 21
  15. if "«initial»" NOT EQ ""
  16.     set keysource Extras2.0:
  17. else
  18.     set keysource «target»
  19.  
  20. ; check if they have a keymaps directory, if not we'll need to get
  21. ; the extras disk swapped in now.
  22.     if not exists «target»devs/keymaps
  23.     makedir >NIL: «target»devs
  24.     makedir >NIL: «target»devs/keymaps
  25.         set keysource Extras2.0:
  26.     endif
  27. endif
  28. set keytarget «target»
  29. ;
  30. echo "*Ec*N                KeyMap Selection"
  31. echo "*NThis procedure will copy a selected keymap from the"
  32. echo "Extras disk onto your Workbench disk."
  33. echo "*N*E[33m*E[1mPlease ensure that you are working with a copy of your"
  34. echo "Workbench disk.*E[22m*E[28m"
  35. echo "*NDo you wish to continue ? (1 = Yes / 0 = No) " noline
  36. unset query
  37. set >NIL: query ?
  38. if NOT "$query" EQ "1"
  39.     if NOT "$query" EQ "y"
  40.         skip keyexit2
  41.     endif
  42. endif
  43. ;
  44. if EXISTS ${keysource}devs/keymaps
  45.     list ${keysource}devs/keymaps lformat "%-8n(%c)" >t:key${process}
  46.     type t:key${process} number to t:akey${process}
  47. endif
  48. echo "    0 usa     (American)" >>t:akey${process}
  49.  
  50. lab keystart
  51. ;
  52. echo "*Ec*N                Select KeyMap*N"
  53. ;
  54. unset number
  55. type t:akey${process}
  56. echo "*NYour choice (RETURN to exit without choosing) ? " noline
  57. set >NIL: number ?
  58. ; did they want to just quit ?
  59. if "$number" EQ "*$number"
  60.     skip keyexit1
  61. endif
  62. ;
  63. ; usa keymap is in rom
  64. if "$number" EQ "0"
  65.     setenv sys/keyboard usa
  66.     skip keyend
  67. endif
  68. ;
  69. ; validity check
  70. if "$number" GT "9"
  71.     echo "*NInvalid selection."
  72.     wait 3 sec
  73.     skip back keystart
  74. else
  75.     if "0" GT "$number"
  76.         echo "*NInvalid selection."
  77.         wait 3 sec
  78.         skip back keystart
  79.     endif
  80. endif
  81.  
  82. ;
  83. ; translate the number into the keymap name
  84. ;
  85. set look string="`echo " $number "`"
  86. ; make sure selection number exists in list
  87. search >NIL: t:akey${process} $look
  88. if WARN
  89.     echo "*NInvalid selection."
  90.     wait 3
  91.     skip back keystart
  92. endif
  93.  
  94. echo "`search t:akey${process} $look`" first 14 len 4 >env:sys/keyboard
  95. ;
  96. ; must copy selected keymap from keysource to ram: to avoid a potential
  97. ; disk swap
  98. copy ${keysource}devs/keymaps/${sys/keyboard} ram: com
  99.  
  100. ; make sure the keymap exists
  101. if not exists ${keytarget}devs/keymaps/${sys/keyboard}
  102.     if "«initial»" EQ ""
  103.         echo "Error: ${sys/keyboard} keymap not found."
  104.         wait 3 sec
  105.         skip back keystart
  106.     endif
  107.     copy ram:${sys/keyboard} ${keytarget}devs/keymaps com
  108. endif
  109.  
  110. ; delete temporary copy of the keymap
  111. delete >NIL: ram:${sys/keyboard} quiet
  112. ;
  113. lab keyend
  114.  
  115. ; set the selected keymap
  116. sys:system/setmap ${sys/keyboard}
  117.  
  118. ; copy the keymap selection into their preferences archive
  119. makedir >NIL: ${keytarget}prefs
  120. makedir >NIL: ${keytarget}prefs/env-archive
  121. makedir >NIL: ${keytarget}prefs/env-archive/sys
  122. echo >${keytarget}prefs/env-archive/sys/keyboard ${sys/keyboard}
  123.  
  124. ;
  125. lab keyexit1
  126.  
  127. delete >NIL: t:key${process} t:akey${process} quiet
  128.  
  129. lab keyexit2
  130.  
  131. resident >NIL: remove copy
  132. resident >NIL: remove list
  133. resident >NIL: remove makedir
  134. resident >NIL: remove search
  135. resident >NIL: remove type
  136.  
  137. unset query
  138. unset look
  139. unset number
  140. unset keysource
  141. unset keytarget
  142.